package com.beizhen.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beizhen.demo.dao.StuTripPlanDao;
import com.beizhen.demo.entity.EntityPage;
import com.beizhen.demo.entity.StuTripPlan;
import com.beizhen.demo.entity.ZhuVo;
import com.beizhen.demo.service.StuTripPlanService;
import com.beizhen.demo.utils.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 出行计划表 业务逻辑接口的实现类
*/
@Service
public class StuTripPlanServiceImpl extends ServiceImpl<StuTripPlanDao, StuTripPlan> implements StuTripPlanService {

    @Autowired
    private StuTripPlanDao stuTripPlanDao;

    /**
     * @param school_u_id
     * @return
     */

    @Override
    public List<String> getClassId(Integer school_u_id) {
        return stuTripPlanDao.getClassId(school_u_id);
    }

    @Override
    public Integer getPeople(String schoolUId) {
        return stuTripPlanDao.getPeople(schoolUId);
    }

    @Override
    public Integer getTeacher(String schoolUId) {
        return stuTripPlanDao.getTeacher(schoolUId);
    }

    @Override
    public Integer getBid(String schoolUId) {
        return stuTripPlanDao.getBid(schoolUId);
    }

    @Override
    public List<ZhuVo>  Basegraphics(String schoolUId) {
        return stuTripPlanDao.Basegraphics(schoolUId);
    }

    @Override
    public Integer getPlan(String schoolUId) {
        return stuTripPlanDao.getPlan(schoolUId);
    }

    @Override
    public List<ZhuVo> getCylinder(String schoolUId) {
        return stuTripPlanDao.getCylinder(schoolUId);
    }

    @Override
    public Integer getcounts(int schoolUId) {
        return stuTripPlanDao.getcounts(schoolUId);
    }

    @Override
    public PageResult<EntityPage> getPlanInfo(int schoolUId, Integer currentpage,
                                              Integer pageIndex) {
        System.out.println(currentpage+","+pageIndex);
        PageHelper.startPage(currentpage,pageIndex);
        List<EntityPage> list=stuTripPlanDao.getPlanInfos(schoolUId);
        Page<EntityPage> page=(Page<EntityPage>)list;
        PageResult<EntityPage> pagePageResult=new PageResult<EntityPage>(page.getTotal(),page.getResult());
        return pagePageResult;
    }
    @Override
    public PageInfo<StuTripPlan> getStuTripPlanList(PageHelper pageHelper, Wrapper wrapper) {
        //    PageHelper.offsetPage(0,2);
        List<StuTripPlan> list=stuTripPlanDao.selectList(wrapper);
        PageInfo<StuTripPlan> pageInfo=new PageInfo<>(list);
        System.out.println("当前页面:" + pageInfo.getPageNum()+"--->"+pageInfo.getPageSize()+"--->上一页:"+pageInfo.getPrePage()+"--->"+pageInfo.getNextPage());
        return pageInfo;
    }

    @Override
    public List<StuTripPlan> sel_StuTripPlan_Byid(Integer b_id) {
        return stuTripPlanDao.sel_StuTripPlan_Byid(b_id);
    }

    @Override
    public List<StuTripPlan> sel_StuTripPlan(Integer b_id) {
        return stuTripPlanDao.sel_StuTripPlan(b_id);
    }
}
